package com.wzm.feign;


import com.wzm.domain.Move;
import com.wzm.domain.User;
import com.wzm.domain.UserMove;
import com.wzm.util.Ajaxresult;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.ArrayList;
import java.util.List;

@Component
public class MoveFallbackFactory implements FallbackFactory<MoveClient> {
    @Override
    public MoveClient create(Throwable throwable) {
        return new MoveClient() {
            @Override
            public List<Move> findAll() {
                return new ArrayList<>();
            }

            @Override
            public Move findById(Long id) {
                return new Move();
            }

            @Override
            public Ajaxresult buyById(@RequestBody UserMove userMove) {
                return new Ajaxresult(false,"服务出错","请稍后重试");
            }

            @Override
            public Ajaxresult sendTicket(UserMove userMove) {
                return new Ajaxresult(false,"服务出错","请稍后重试");
            }

            @Override
            public Ajaxresult watch(Long id) {
                return new Ajaxresult(false,"服务出错","请稍后重试");
            }
        };
    }
}
